from PyCmpltrtok.common import sep
from collections import OrderedDict

if __name__ == '__main__':

    od = OrderedDict()
    for i in range(10):
        n = i + 1
        od[f'{n}'] = f'v{n}'
    print(od)
    sep('move 1 to the end')
    od.move_to_end('1')
    print(od)
    sep('pop 4')
    v4 = od.pop('4')
    print(od)
    print('4:', v4)
    sep('pop 40')
    # v4 = od.pop('40')  # KeyError: '40'
    v4 = od.pop('40', 'default v40')
    print(od)
    print('4:', v4)
    sep('popitem')
    item = od.popitem()
    print(od)
    print('item:', item)
    sep('popitem last=False')
    item = od.popitem(last=False)
    print(od)
    print('item:', item)
